using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class SurveyResultMap : EntityTypeConfiguration<SurveyResult>
    {
        public SurveyResultMap()
        {
            // Primary Key
            this.HasKey(t => t.Result_id);

            // Properties
            this.Property(t => t.InputText)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("SurveyResult");
            this.Property(t => t.Result_id).HasColumnName("Result_id");
            this.Property(t => t.Session_id).HasColumnName("Session_id");
            this.Property(t => t.Survey_id).HasColumnName("Survey_id");
            this.Property(t => t.Question_id).HasColumnName("Question_id");
            this.Property(t => t.Option_id).HasColumnName("Option_id");
            this.Property(t => t.OptionValue).HasColumnName("OptionValue");
            this.Property(t => t.InputText).HasColumnName("InputText");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");

            // Relationships
            this.HasRequired(t => t.SurveySession)
                .WithMany(t => t.SurveyResults)
                .HasForeignKey(d => d.Session_id);

        }
    }
}
